package com.zzuisa.sell.controller;

import com.zzuisa.sell.dto.OrderDTO;
import com.zzuisa.sell.enums.ResultEnum;
import com.zzuisa.sell.exception.SellException;
import com.zzuisa.sell.service.OrderService;
import com.zzuisa.sell.service.impl.OrderServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.nio.channels.SelectableChannel;

/**
 * @ClassName PayController
 * @Description TODO
 * @Author SunAo
 * @Date 2018/8/20 上午1:41
 * @Version 1.0
 */
@Controller
@RequestMapping("/pay")
public class PayController {
    @Autowired

    private OrderService orderService;
    @GetMapping("/create")
    public void create(@RequestParam("orderId") String orderId,
                       @RequestParam("resultUrl") String returnUrl) {
        //1.查询订单
        OrderDTO orderDTO = orderService.findOne(orderId);
        if (orderDTO == null) {
            throw new SellException(ResultEnum.ORDER_NOT_EXIST);
        }
        //2.发起支付
    }
}
